local extension = Package("tgong_ss")
extension.extensionName = "tshu"

Fk:loadTranslationTable{
  ["tgong_ss"] = "天宫.神兽",
  ["tshuss"] = "神兽",
}

local U = require "packages/utility/utility"

local qlong = General(extension, "tshuss__qinglong","wu",16)
qlong.hidden = true
local longhui = fk.CreateTriggerSkill{
    name = "tshu__longhui",
    anim_type = "drawcard",
    frequency = Skill.Compulsory,
    events = {fk.EventPhaseStart},
    can_trigger = function(self, event, target, player, data)
      return target == player and player.phase == Player.Start and player:hasSkill(self)
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local n = 3
      local a = player.room:getBanner("@[:]tshu__xingxiang") or 0
      if a == "tshu__east" then
        n = 6
      end
      local cards = room:getCardsFromPileByRule(".|.|.|.|.|trick",n,"allPiles")
        if #cards > 0 then
            room:moveCards({
            ids = cards,
            to = player.id,
            toArea = Card.PlayerHand,
            moveReason = fk.ReasonJustMove,
            proposer = player.id,
            skillName = self.name,
            })
        end
    end,
}
local longlin = fk.CreateTriggerSkill{
    name = "tshu__longlin",
    mute = true,
    frequency = Skill.Compulsory,
    events = {fk.DamageInflicted,fk.DamageCaused},
    can_trigger = function(self, event, target, player, data)
        if event == fk.DamageInflicted then
            return target == player and  player:hasSkill(self) and data.card and data.card.type == Card.TypeTrick
        elseif event == fk.DamageCaused then
            return target == player and  player:hasSkill(self) and data.card and data.card.type == Card.TypeTrick and (player.room:getBanner("@[:]tshu__xingxiang") or 0) == "tshu__east"
        end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      if event == fk.DamageInflicted then
        player:broadcastSkillInvoke(self.name)
        room:notifySkillInvoked(player,self.name,"defensive")
        return true
      elseif event == fk.DamageCaused then
        player:broadcastSkillInvoke(self.name)
        room:notifySkillInvoked(player,self.name,"offensive")
        data.damage = data.damage + 1
      end
    end,
}
qlong:addSkill(longhui)
qlong:addSkill(longlin)
Fk:loadTranslationTable{
    ["tshuss__qinglong"] = "青龙",
    ["tshu__longhui"] = "龙慧",
    [":tshu__longhui"] = "锁定技，准备阶段，你从牌堆或弃牌堆随机获得3张锦囊牌；若当前“星象”为“东宫”，则改为获得6张锦囊牌。",
    ["tshu__longlin"] = "龙鳞",
    [":tshu__longlin"] = "锁定技，防止你受到的锦囊牌伤害；若当前“星象”为“东宫”，则你使用锦囊牌造成的伤害+1。",
    ["$tshu__longhui"] = "龙曜九天，慧眼如炬。",
    ["$tshu__longlin"] = "金鳞护体，风雨不侵。",
    ["~tshuss__qinglong"] = "木震卦变，大凶之危。",
}

local zhuque = General(extension, "tshuss__zhuque","shu",16,16,General.Female)
zhuque.hidden = true
local zhuyu = fk.CreateTriggerSkill{
    name = "tshu__zhuyu",
    anim_type = "drawcard",
    frequency = Skill.Compulsory,
    events = {fk.EventPhaseStart},
    can_trigger = function(self, event, target, player, data)
      return target == player and player.phase == Player.Start and player:hasSkill(self)
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local cards = {}
      local card
      card = room:getCardsFromPileByRule(".|.|heart",1,"allPiles")
      table.insertTable(cards,card)
      card = room:getCardsFromPileByRule(".|.|diamond",1,"allPiles")
      table.insertTable(cards,card)
      card = room:getCardsFromPileByRule(".|.|club",1,"allPiles")
      table.insertTable(cards,card)
      card = room:getCardsFromPileByRule(".|.|spade",1,"allPiles")
      table.insertTable(cards,card)
        if #cards > 0 then
            room:moveCards({
            ids = cards,
            to = player.id,
            toArea = Card.PlayerHand,
            moveReason = fk.ReasonJustMove,
            proposer = player.id,
            skillName = self.name,
            })
        end
    end,
}
local tianhuo = fk.CreateActiveSkill{
    name = "tshu__tianhuo",
    anim_type = "offensive",
    min_target_num = 1,
    max_target_num = 2,
    card_num = 1,
    prompt = function(self, player)
        local x = (Fk:currentRoom():getBanner("@[:]tshu__xingxiang") or 0)
        if x == "tshu__south" then
            return "#tshu__tianhuo1"
        else
            return "#tshu__tianhuo2"
        end
    end,
    can_use = function(self, player)
      return  true
    end,
    card_filter = function(self, to_select, selected)
      local x = (Fk:currentRoom():getBanner("@[:]tshu__xingxiang") or 0)
      if x == "tshu__south" then
        return #selected == 0
      else
        return #selected == 0 and not table.contains(type(Self:getMark("@tshu__tianhuo-phase")) == "table" and Self:getMark("@tshu__tianhuo-phase") or {},Fk:getCardById(to_select):getSuitString(true))
      end
    end,
    target_filter = function(self, to_select, selected)
      local target = Fk:currentRoom():getPlayerById(to_select)
        return #selected < 2 and to_select ~= Self.id and ((Self.role == "rebel" and target and target.role ~= "rebel") or ((Self.role == "lord" or Self.role == "loyalist") and (target and target.role ~= "lord" and target.role ~= "loyalist")))
    end,
    on_use = function(self, room, effect)
      local player = room:getPlayerById(effect.from)
      local card = Fk:getCardById(effect.cards[1])
      local suit = card:getSuitString(true)
      local record = type(player:getMark("@tshu__tianhuo-phase")) == "table" and player:getMark("@tshu__tianhuo-phase") or {}
      table.insertIfNeed(record, suit)
      room:setPlayerMark(player, "@tshu__tianhuo-phase", record)
      room:moveCardTo(card,Card.DiscardPile,player,fk.ReasonDiscard)
      for _, pid in ipairs(effect.tos) do
        local to = room:getPlayerById(pid)
          room:damage({
            from = player,
            to = to,
            damage = 1,
            damageType = fk.FireDamage,
            skillName = self.name,
          })
      end
    end,
}
zhuque:addSkill(zhuyu)
zhuque:addSkill(tianhuo)
Fk:loadTranslationTable{
    ["tshuss__zhuque"] = "朱雀",
    ["tshu__zhuyu"] = "朱羽",
    [":tshu__zhuyu"] = "锁定技，准备阶段，你从牌堆或弃牌堆随机获得四个种花色各一张牌。",
    ["tshu__tianhuo"] = "天火",
    [":tshu__tianhuo"] = "出牌阶段每种花色限一次，你可以弃置一张牌然后对至多两名敌方角色各造成一点火焰伤害；若当前“星象”为“南宫”，花色无次数限制。",

    ["#tshu__tianhuo1"] = "你可以弃置一张牌并对至多两名敌方角色各造成一点火焰伤害。",
    ["#tshu__tianhuo2"] = "每种花色限一次，你可以弃置一张牌并对至多两名敌方角色各造成一点火焰伤害。",
    ["@tshu__tianhuo-phase"] = "天火",
    ["$tshu__zhuyu"] = "玄羽厉火，赤鳞硕天。",
    ["$tshu__tianhuo"] = "离火天降，炼狱即临。",
    ["~tshuss__zhuque"] = "火离卦变，大凶之危。",
}

local baihu = General(extension, "tshuss__baihu","qun",16)
baihu.hidden = true
local huwei = fk.CreateTriggerSkill{
    name = "tshu__huwei",
    anim_type = "drawcard",
    frequency = Skill.Compulsory,
    events = {fk.EventPhaseStart},
    can_trigger = function(self, event, target, player, data)
      return target == player and player.phase == Player.Start and player:hasSkill(self)
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local n = 3
      local a = player.room:getBanner("@[:]tshu__xingxiang") or 0
      if a == "tshu__west" then
        n = 6
      end
      local cards = room:getCardsFromPileByRule("slash",n,"allPiles")
        if #cards > 0 then
            room:moveCards({
            ids = cards,
            to = player.id,
            toArea = Card.PlayerHand,
            moveReason = fk.ReasonJustMove,
            proposer = player.id,
            skillName = self.name,
            })
        end
    end,
}
local tianxiao = fk.CreateTriggerSkill{
    name = "tshu__tianxiao",
    anim_type = "offensive",
    frequency = Skill.Compulsory,
    events = {fk.AfterCardTargetDeclared},
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self) and
        data.card.trueName == "slash" and
        #player.room:getUseExtraTargets( data, true) > 0
    end,
    on_use = function(self, event, target, player, data)
      for _, id in ipairs(player.room:getUseExtraTargets( data, true)) do
        local p = player.room:getPlayerById(id)
        if  ((player.role == "rebel" and p.role ~= "rebel") or ((player.role == "lord" or player.role == "loyalist") and (p.role ~= "lord" and p.role ~= "loyalist"))) then
          player.room:doIndicate(player.id, {id})
          TargetGroup:pushTargets(data.tos, id)
        end
      end
    end,
}
local tianxiao_targetmod = fk.CreateTargetModSkill{
    name = "#tshu__tianxiao_targetmod",
    frequency = Skill.Compulsory,
    bypass_distances = function(self, player, skill, card, to)
      return player:hasSkill(self) and card and card.trueName == "slash"
    end,
    residue_func = function(self, player, skill, scope)
        if skill.trueName == "slash_skill" and player:hasSkill(self) then
            local x = (Fk:currentRoom():getBanner("@[:]tshu__xingxiang") or 0)
            if x == "tshu__west" then
                return 999
            else
                return 2
            end
        end
        return 0
      end,
}
tianxiao:addRelatedSkill(tianxiao_targetmod)
baihu:addSkill(huwei)
baihu:addSkill(tianxiao)
Fk:loadTranslationTable{
    ["tshuss__baihu"] = "白虎",
    ["tshu__huwei"] = "虎威",
    [":tshu__huwei"] = "锁定技，准备阶段，你从牌堆或弃牌堆随机获得3张【杀】；若当前“星象”为“西宫”，则改为获得6张【杀】。",
    ["tshu__tianxiao"] = "天啸",
    [":tshu__tianxiao"] = "锁定技，你使用【杀】无距离限制且指定所有敌方角色为目标，出牌阶段你可以多使用两张【杀】；若当前“星象”为“西宫”，则你使用【杀】无次数限制。",

    ["$tshu__huwei"] = "..凶意来潮。",
    ["$tshu__tianxiao"] = "白茫越四野，虎啸震八方。",
    ["~tshuss__baihu"] = "金兑卦变，大凶之危。",
}

local xuanwu = General(extension, "tshuss__xuanwu","wei",16,16,General.Female)
xuanwu.hidden = true
local shengqu = fk.CreateTriggerSkill{
    name = "tshu__shengqu",
    mute = true,
    frequency = Skill.Compulsory,
    events = {fk.DamageInflicted,fk.Damaged},
    can_trigger = function(self, event, target, player, data)
        if target == player and player:hasSkill(self) then
            local room = player.room
            if event == fk.DamageInflicted and data.damage and data.damage > 1 then 
              local n = 0
                for _, p in ipairs(room:getOtherPlayers(player)) do
                    if ((player.role == "rebel" and p.role == "rebel") or ((player.role == "lord" or player.role == "loyalist") and (p.role == "lord" or p.role == "loyalist"))) then
                    n = n + 1
                    if n > 1 then
                          return true
                        end
                    end

                end
            elseif event == fk.Damaged then
                return true
            end
        end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      if event == fk.DamageInflicted  then
        player:broadcastSkillInvoke(self.name)
        room:notifySkillInvoked(player,self.name,"defensive")
        return true
      elseif event == fk.Damaged then
        if not player.dead then
            player:broadcastSkillInvoke(self.name)
            room:notifySkillInvoked(player,self.name,"drawcard")
            player:drawCards(2,self.name)
        end
      end
    end,
}
local xuankai = fk.CreateTriggerSkill{
    name = "tshu__xuankai",
    mute = true,
    priority = 2,
    frequency = Skill.Compulsory,
    events = {fk.Damaged,fk.CardUsing,fk.Damage},
    can_trigger = function(self, event, target, player, data)
        if event == fk.Damaged then
            return target == player and player:hasSkill(self) and player:getMark("@@tshu__xuankai") == 0
        elseif event == fk.CardUsing then
            return target == player and player:hasSkill(self) and player:getMark("@@tshu__xuankai") > 0
        elseif event == fk.Damage then
            return target == player and player:hasSkill(self)
        end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      if event == fk.Damaged then
        room:setPlayerMark(player,"@@tshu__xuankai",1)
      elseif event == fk.CardUsing then
        player:broadcastSkillInvoke(self.name)
        room:notifySkillInvoked(player,self.name,"offensive")
        room:setPlayerMark(player,"@@tshu__xuankai",0)
        data.disresponsiveList = data.disresponsiveList or {}
        for _, p in ipairs(room.alive_players) do
          table.insertIfNeed(data.disresponsiveList, p.id)
        end
      elseif event == fk.Damage then
        local a = player.room:getBanner("@[:]tshu__xingxiang") or 0
        if a == "tshu__north" and data.to and not data.to.dead and not data.to:isNude() and room:askForSkillInvoke(player,self.name,nil,"玄铠：获得%dest至多两张牌，或点取消摸两张牌。::"..data.to.id) then
            player:broadcastSkillInvoke(self.name)
            room:notifySkillInvoked(player,self.name,"control")
            local cards = room:askForCardsChosen(player,data.to,1,2,"he",self.name)
            if #cards > 0 then
                room:moveCardTo(cards,Card.PlayerHand,player,fk.ReasonPrey,self.name)
            end
        else
            if not player.dead then
                player:broadcastSkillInvoke(self.name)
                room:notifySkillInvoked(player,self.name,"drawcard")
                player:drawCards(2,self.name)
            end
        end
      end
    end,
}
xuanwu:addSkill(shengqu)
xuanwu:addSkill(xuankai)
Fk:loadTranslationTable{
    ["tshuss__xuanwu"] = "玄武",
    ["tshu__shengqu"] = "圣躯",
    [":tshu__shengqu"] = "锁定技，当你受到伤害后，你摸两张牌；若友方角色（不含自身）大于1，防止你受到大于1点的伤害。",
    ["tshu__xuankai"] = "玄铠",
    [":tshu__xuankai"] = "锁定技，你受到伤害后，你使用的下一次张牌无法被响应；你造成伤害后，你摸两张牌；若当前“星象”为“北宫”，则改为可以获得受伤角色至多两张牌。",

    ["@@tshu__xuankai"] = "玄铠",

    ["$tshu__shengqu"] = "神龟天泽，其寿永昌。",
    ["$tshu__xuankai"] = "玄踞北冥，不动如山。",
    ["~tshuss__xuanwu"] = "水坎卦变，大凶之危。",
}


------卦象技

local muzhen = fk.CreateTriggerSkill{
  name = "tshu__muzhen",
  mute = true,
  priority = 3,
  frequency = Skill.Compulsory,
  events = {fk.RoundStart,fk.DamageInflicted,fk.PreHpLost,fk.TurnedOver,fk.Deathed,fk.Death},
  can_trigger = function(self, event, target, player, data)
    local room = player.room
      if event == fk.RoundStart then
          return  player:hasSkill(self) 
      elseif event == fk.DamageInflicted then
        return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__jiaomujiao-bj")
      elseif event == fk.PreHpLost then
          return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__kangjinlong-bj")
      elseif event == fk.TurnedOver then
        return  target == player and player:hasSkill(self) and player.faceup and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") ~= "tshu_gua_zhen"
      elseif event == fk.Deathed then
        return target and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and ((table.contains(player:getMark("@tshu__xxiang"),"tshuxx__jiaomujiao-bj") and target.general == "tshuxx__jiaomujiao") or (table.contains(player:getMark("@tshu__xxiang"),"tshuxx__kangjinlong-bj") and target.general == "tshuxx__kangjinlong"))
      elseif event == fk.Death then
        return target == player and player:hasSkill(self,true,true) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0
      end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.RoundStart then
      local gua = room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") or 0
      local face = true
      if gua ~= "tshu_gua_zhen"  and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 then
        face = false
      end
      if (player.faceup and not face) or (not player.faceup and  face ) then
        room:notifySkillInvoked(player,self.name,"negative")
        player:turnOver()
      end
    elseif event == fk.DamageInflicted or event == fk.PreHpLost then
      room:notifySkillInvoked(player,self.name,"defensive")
      return true
    elseif event == fk.TurnedOver then
      room:notifySkillInvoked(player,self.name,"negative")
      player:turnOver()
    elseif event == fk.Deathed then
      if target.general == "tshuxx__jiaomujiao" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__jiaomujiao-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      elseif target.general == "tshuxx__kangjinlong" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__kangjinlong-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      end
      if not ( type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 ) then
        room:broadcastPlaySound("./audio/system/losemaxhp")
        room:notifySkillInvoked(player,"破卦","special")
        room:setPlayerMark(player,"@tshu__xxiang",0)
        room.logic:trigger("fk.tgong_pogua",player,self.name)
      end
    elseif event == fk.Death then
      room:broadcastPlaySound("./audio/system/losemaxhp")
      room:notifySkillInvoked(player,"破卦","special")
      room.logic:trigger("fk.tgong_pogua",player,self.name)
      for _, p in ipairs(room.alive_players) do
        if p.general == "tshuxx__jiaomujiao" or p.general == "tshuxx__kangjinlong" then
          room:killPlayer({who = p.id})
        end
      end
    end
  end,
}
local muzhen_prohibit = fk.CreateProhibitSkill{
  name = "#tshu__muzhen_prohibit",
  prohibit_use = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
  prohibit_response = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
}
muzhen:addRelatedSkill(muzhen_prohibit)
Fk:addSkill(muzhen)
Fk:loadTranslationTable{
  ["tshu__muzhen"] = "木震",
  [":tshu__muzhen"] = "锁定技，<br>每轮开始或当你翻面时，若本轮卦象不为“震”且你持有“星宿”，你将武将牌翻至背面向上,否则翻至正面向上；你的武将牌背面向上时无法使用或打出牌；"..
  "<br>若你持有星宿“<font color='red'>角木蛟</font>”，防止你受到的伤害；若你持有星宿“<font color='yellow'>亢金龙</font>”，防止你受到的体力流失；"..
  "<br>当“<font color='red'>角木蛟</font>”或“<font color='yellow'>亢金龙</font>”死亡后，你移除对应“星宿”;你死亡后，令场上“<font color='red'>角木蛟</font>”和“<font color='yellow'>亢金龙</font>”死亡。",

  ["@tshu__xxiang"] = "",
  ["tshuxx__jiaomujiao-bj"] = "<font color='red'>角木蛟</font>",
  ["tshuxx__kangjinlong-bj"] = "<font color='yellow'>亢金龙</font>",
}

local lihuo = fk.CreateTriggerSkill{
  name = "tshu__lihuo",
  mute = true,
  priority = 3,
  frequency = Skill.Compulsory,
  events = {fk.RoundStart,fk.DamageInflicted,fk.PreHpLost,fk.TurnedOver,fk.Deathed,fk.Death},
  can_trigger = function(self, event, target, player, data)
    local room = player.room
      if event == fk.RoundStart then
          return  player:hasSkill(self) 
      elseif event == fk.DamageInflicted then
        return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__xingrima-bj")
      elseif event == fk.PreHpLost then
          return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__yihuoshe-bj")
      elseif event == fk.TurnedOver then
        return  target == player and player:hasSkill(self) and player.faceup and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") ~= "tshu_gua_li"
      elseif event == fk.Deathed then
        return target and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and ((table.contains(player:getMark("@tshu__xxiang"),"tshuxx__xingrima-bj") and target.general == "tshuxx__xingrima") or (table.contains(player:getMark("@tshu__xxiang"),"tshuxx__yihuoshe-bj") and target.general == "tshuxx__yihuoshe"))
      elseif event == fk.Death then
        return target == player and player:hasSkill(self,true,true) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0
      end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.RoundStart then
      local gua = room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") or 0
      local face = true
      if gua ~= "tshu_gua_li" and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 then
        face = false
      end
      if (player.faceup and not face) or (not player.faceup and  face ) then
        room:notifySkillInvoked(player,self.name,"negative")
        player:turnOver()
      end
    elseif event == fk.DamageInflicted or event == fk.PreHpLost then
      room:notifySkillInvoked(player,self.name,"defensive")
      return true
    elseif event == fk.TurnedOver then
      room:notifySkillInvoked(player,self.name,"negative")
      player:turnOver()
    elseif event == fk.Deathed then
      if target.general == "tshuxx__yihuoshe" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__yihuoshe-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      elseif target.general == "tshuxx__xingrima" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__xingrima-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      end
      if not ( type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 ) then
        room:broadcastPlaySound("./audio/system/losemaxhp")
        room:notifySkillInvoked(player,"破卦","special")
        room:setPlayerMark(player,"@tshu__xxiang",0)
        room.logic:trigger("fk.tgong_pogua",player,self.name)
      end
    elseif event == fk.Death then
      room:broadcastPlaySound("./audio/system/losemaxhp")
      room:notifySkillInvoked(player,"破卦","special")
      room.logic:trigger("fk.tgong_pogua",player,self.name)
      for _, p in ipairs(room.alive_players) do
        if p.general == "tshuxx__yihuoshe" or p.general == "tshuxx__xingrima" then
          room:killPlayer({who = p.id})
        end
      end
    end
  end,
}
local lihuo_prohibit = fk.CreateProhibitSkill{
  name = "#tshu__lihuo_prohibit",
  prohibit_use = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
  prohibit_response = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
}
lihuo:addRelatedSkill(lihuo_prohibit)
Fk:addSkill(lihuo)
Fk:loadTranslationTable{
  ["tshu__lihuo"] = "离火",
  [":tshu__lihuo"] = "锁定技，<br>每轮开始或当你翻面时，若本轮卦象不为“离”且你持有“星宿”，你将武将牌翻至背面向上，否则翻至正面向上；你的武将牌背面向上时无法使用或打出牌；"..
  "<br>若你持有星宿“<font color='red'>星日马</font>”，防止你受到的伤害；若你持有星宿“<font color='yellow'>翼火蛇</font>”，防止你受到的体力流失；"..
  "<br>当“<font color='red'>星日马</font>”或“<font color='yellow'>翼火蛇</font>”死亡后，你移除对应“星宿”；你死亡后，令场上“<font color='red'>星日马</font>”和“<font color='yellow'>翼火蛇</font>”死亡。",

  ["tshuxx__xingrima-bj"] = "<font color='red'>星日马</font>",
  ["tshuxx__yihuoshe-bj"] = "<font color='yellow'>翼火蛇</font>",
}

local duijin = fk.CreateTriggerSkill{
  name = "tshu__duijin",
  mute = true,
  priority = 3,
  frequency = Skill.Compulsory,
  events = {fk.RoundStart,fk.DamageInflicted,fk.PreHpLost,fk.TurnedOver,fk.Deathed,fk.Death},
  can_trigger = function(self, event, target, player, data)
    local room = player.room
      if event == fk.RoundStart then
          return  player:hasSkill(self) 
      elseif event == fk.DamageInflicted then
        return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__kuimulang-bj")
      elseif event == fk.PreHpLost then
          return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__canshuiyuan-bj")
      elseif event == fk.TurnedOver then
        return  target == player and player:hasSkill(self) and player.faceup and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") ~= "tshu_gua_dui"
      elseif event == fk.Deathed then
        return target and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and ((table.contains(player:getMark("@tshu__xxiang"),"tshuxx__kuimulang-bj") and target.general == "tshuxx__kuimulang") or (table.contains(player:getMark("@tshu__xxiang"),"tshuxx__canshuiyuan-bj") and target.general == "tshuxx__canshuiyuan"))
      elseif event == fk.Death then
        return target == player and player:hasSkill(self,true,true) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0
      end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.RoundStart then
      local gua = room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") or 0
      local face = true
      if gua ~= "tshu_gua_dui" and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 then
        face = false
      end
      if (player.faceup and not face) or (not player.faceup and  face ) then
        room:notifySkillInvoked(player,self.name,"negative")
        player:turnOver()
      end
    elseif event == fk.DamageInflicted or event == fk.PreHpLost then
      room:notifySkillInvoked(player,self.name,"defensive")
      return true
    elseif event == fk.TurnedOver then
      room:notifySkillInvoked(player,self.name,"negative")
      player:turnOver()
    elseif event == fk.Deathed then
      if target.general == "tshuxx__kuimulang" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__kuimulang-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      elseif target.general == "tshuxx__canshuiyuan" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__canshuiyuan-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      end
      if not ( type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 ) then
        room:broadcastPlaySound("./audio/system/losemaxhp")
        room:notifySkillInvoked(player,"破卦","special")
        room:setPlayerMark(player,"@tshu__xxiang",0)
        room.logic:trigger("fk.tgong_pogua",player,self.name)
      end
    elseif event == fk.Death then
      room:broadcastPlaySound("./audio/system/losemaxhp")
      room:notifySkillInvoked(player,"破卦","special")
      room.logic:trigger("fk.tgong_pogua",player,self.name)
      for _, p in ipairs(room.alive_players) do
        if p.general == "tshuxx__kuimulang" or p.general == "tshuxx__canshuiyuan" then
          room:killPlayer({who = p.id})
        end
      end
    end
  end,
}
local duijin_prohibit = fk.CreateProhibitSkill{
  name = "#tshu__duijin_prohibit",
  prohibit_use = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
  prohibit_response = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
}
duijin:addRelatedSkill(duijin_prohibit)
Fk:addSkill(duijin)
Fk:loadTranslationTable{
  ["tshu__duijin"] = "兑金",
  [":tshu__duijin"] = "锁定技，<br>每轮开始或当你翻面时，若本轮卦象不为“兑”且你持有“星宿”，你将武将牌翻至背面向上，否则翻至正面向上；你的武将牌背面向上时无法使用或打出牌；"..
  "<br>若你持有星宿“<font color='red'>奎木狼</font>”，防止你受到的伤害；若你持有星宿“<font color='yellow'>参水猿</font>”，防止你受到的体力流失；"..
  "<br>当“<font color='red'>奎木狼</font>”或“<font color='yellow'>参水猿</font>”死亡后，你移除对应“星宿”;你死亡后，令场上“<font color='red'>奎木狼</font>”和“<font color='yellow'>参水猿</font>死亡”。",

  ["tshuxx__kuimulang-bj"] = "<font color='red'>奎木狼</font>",
  ["tshuxx__canshuiyuan-bj"] = "<font color='yellow'>参水猿</font>",
}

local shuikan = fk.CreateTriggerSkill{
  name = "tshu__shuikan",
  mute = true,
  priority = 3,
  frequency = Skill.Compulsory,
  events = {fk.RoundStart,fk.DamageInflicted,fk.PreHpLost,fk.TurnedOver,fk.Deathed,fk.Death},
  can_trigger = function(self, event, target, player, data)
    local room = player.room
      if event == fk.RoundStart then
          return  player:hasSkill(self) 
      elseif event == fk.DamageInflicted then
        return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__weiyueyan-bj")
      elseif event == fk.PreHpLost then
          return target == player and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table"  and table.contains(player:getMark("@tshu__xxiang"),"tshuxx__doumuxie-bj")
      elseif event == fk.TurnedOver then
        return  target == player and player:hasSkill(self) and player.faceup and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") ~= "tshu_gua_kan"
      elseif event == fk.Deathed then
        return target and player:hasSkill(self) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 
        and ((table.contains(player:getMark("@tshu__xxiang"),"tshuxx__weiyueyan-bj") and target.general == "tshuxx__weiyueyan") or (table.contains(player:getMark("@tshu__xxiang"),"tshuxx__doumuxie-bj") and target.general == "tshuxx__doumuxie"))
      elseif event == fk.Death then
        return target == player and player:hasSkill(self,true,true) and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0
      end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.RoundStart then
      local gua = room:getBanner("@tshu_guaxiang") and room:getBanner("@tshu_guaxiang") or 0
      local face = true
      if gua ~= "tshu_gua_kan" and type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 then
        face = false
      end
      if (player.faceup and not face) or (not player.faceup and  face ) then
        room:notifySkillInvoked(player,self.name,"negative")
        player:turnOver()
      end
    elseif event == fk.DamageInflicted or event == fk.PreHpLost then
      room:notifySkillInvoked(player,self.name,"defensive")
      return true
    elseif event == fk.TurnedOver then
      room:notifySkillInvoked(player,self.name,"negative")
      player:turnOver()
    elseif event == fk.Deathed then
      if target.general == "tshuxx__weiyueyan" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__weiyueyan-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      elseif target.general == "tshuxx__doumuxie" then
        local xx = type(player:getMark("@tshu__xxiang")) == "table" and player:getMark("@tshu__xxiang") or {}
        table.removeOne(xx,"tshuxx__doumuxie-bj")
        room:notifySkillInvoked(player,self.name,"negative")
        room:broadcastPlaySound("./audio/system/losehp")
        room:setPlayerMark(player,"@tshu__xxiang",xx)
      end
      if not ( type(player:getMark("@tshu__xxiang")) == "table" and #player:getMark("@tshu__xxiang") > 0 ) then
        room:broadcastPlaySound("./audio/system/losemaxhp")
        room:notifySkillInvoked(player,"破卦","special")
        room:setPlayerMark(player,"@tshu__xxiang",0)
        room.logic:trigger("fk.tgong_pogua",player,self.name)
      end
    elseif event == fk.Death then
      room:broadcastPlaySound("./audio/system/losemaxhp")
      room:notifySkillInvoked(player,"破卦","special")
      room.logic:trigger("fk.tgong_pogua",player,self.name)
      for _, p in ipairs(room.alive_players) do
        if p.general == "tshuxx__weiyueyan" or p.general == "tshuxx__doumuxie" then
          room:killPlayer({who = p.id})
        end
      end
    end
  end,
}
local shuikan_prohibit = fk.CreateProhibitSkill{
  name = "#tshu__shuikan_prohibit",
  prohibit_use = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
  prohibit_response = function(self, player, card)
      return player:hasSkill(self) and not player.faceup
  end,
}
shuikan:addRelatedSkill(shuikan_prohibit)
Fk:addSkill(shuikan)
Fk:loadTranslationTable{
  ["tshu__shuikan"] = "水坎",
  [":tshu__shuikan"] = "锁定技，<br>每轮开始或当你翻面时，若本轮卦象不为“坎”且你持有“星宿”，你将武将牌翻至背面向上，否则翻至正面向上；你的武将牌背面向上时无法使用或打出牌；"..
  "<br>若你持有星宿“<font color='red'>危月燕</font>”，防止你受到的伤害；若你持有星宿“<font color='yellow'>斗木獬</font>”，防止你受到的体力流失；"..
  "<br>当“<font color='red'>危月燕</font>”或“<font color='yellow'>斗木獬</font>”死亡后，你移除对应“星宿”；你死亡后，令场上“<font color='red'>危月燕</font>”和“<font color='yellow'>斗木獬</font>”死亡。",

  ["tshuxx__weiyueyan-bj"] = "<font color='red'>危月燕</font>",
  ["tshuxx__doumuxie-bj"] = "<font color='yellow'>斗木獬</font>",
}


local gongzhu = fk.CreateTriggerSkill{
  name = "tshu__gongzhu",
  mute = true,
  priority = 2,
  frequency = Skill.Compulsory,
  events = {fk.DamageInflicted,fk.PreHpLost,fk.DamageCaused,fk.Damage,fk.CardUsing,fk.EventPhaseChanging,fk.EventPhaseStart,fk.AfterCardTargetDeclared,fk.Deathed},
  can_trigger = function(self, event, target, player, data)
    local room = player.room
      if event == fk.DamageInflicted or event == fk.PreHpLost then
        return target == player and player:hasSkill(self) and type(player:getMark("@tshu__4shen")) == "table" and #player:getMark("@tshu__4shen") > 0
      elseif event == fk.DamageCaused then
        return target == player and player:hasSkill(self) and type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_north")
      elseif event == fk.Damage then
        return target == player and player:hasSkill(self) and player:isWounded() and not (type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_north"))
      elseif event == fk.CardUsing then
        return target == player and player:hasSkill(self) and data.card and data.card.type == Card.TypeBasic and not (type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_south"))
      elseif event == fk.EventPhaseChanging then
        return target == player and player:hasSkill(self) and data.to == Player.Draw and type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_west")
      elseif event == fk.EventPhaseStart then
        return target == player and player:hasSkill(self) and player.phase == Player.Draw and not (type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_west"))
      elseif event == fk.AfterCardTargetDeclared then
        return target == player and player:hasSkill(self)  and not (type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_east")) 
        and data.card:isCommonTrick() and #player.room:getUseExtraTargets( data) > 0 and not player.dead
      elseif event == fk.Deathed then
        return target and player:hasSkill(self) and type(player:getMark("@tshu__4shen")) == "table" and #player:getMark("@tshu__4shen") > 0 
        and ((table.contains(player:getMark("@tshu__4shen"),"tshu_east") and target.general == "tshuss__qinglong") or (table.contains(player:getMark("@tshu__4shen"),"tshu_west") and target.general == "tshuss__baihu") 
        or (table.contains(player:getMark("@tshu__4shen"),"tshu_south") and target.general == "tshuss__zhuque") or (table.contains(player:getMark("@tshu__4shen"),"tshu_north") and target.general == "tshuss__xuanwu"))
      end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.DamageInflicted or event == fk.PreHpLost then
      room:notifySkillInvoked(player,self.name,"defensive")
      return true
    elseif event == fk.DamageCaused then
      room:notifySkillInvoked(player,self.name,"negative")
      return true
    elseif event == fk.Damage then
      room:notifySkillInvoked(player,self.name,"support")
      room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = self.name
      })
    elseif event == fk.CardUsing then
      room:notifySkillInvoked(player,self.name,"offensive")
      data.disresponsiveList = data.disresponsiveList or {}
      for _, p in ipairs(room.alive_players) do
        table.insertIfNeed(data.disresponsiveList, p.id)
      end
    elseif event == fk.EventPhaseChanging then
      room:notifySkillInvoked(player,self.name,"negative")
      return true
    elseif event == fk.EventPhaseStart then
      local cards = {}
      for _, p in ipairs(room.alive_players) do
        if p.role ~= "lord" and p.role ~= "loyalist" and not p:isNude() then
          table.insertTable(cards,table.random(p:getCardIds("he"),2))
        end
      end
      if #cards > 0 then
        room:notifySkillInvoked(player,self.name,"control")
        room:moveCardTo(cards,Card.PlayerHand,player,fk.ReasonPrey)
      end
    elseif event == fk.AfterCardTargetDeclared then
      local tos = {}
      for _, p in ipairs(room:getOtherPlayers(player)) do
        if p.role == "rebel" or p.role == "renegade" then
          table.insert(tos,p.id)
        end
      end
      room:notifySkillInvoked(player,self.name,"offensive")
      table.forEach(tos, function (id)
        table.insert(data.tos, {id})
      end)
    elseif event == fk.Deathed then
      local ss = type(player:getMark("@tshu__4shen")) == "table" and player:getMark("@tshu__4shen") or {}
      if target.general == "tshuss__qinglong" then
        table.removeOne(ss,"tshu_east")
      elseif target.general == "tshuss__baihu" then
        table.removeOne(ss,"tshu_west")
      elseif target.general == "tshuss__zhuque" then
        table.removeOne(ss,"tshu_south")
      elseif target.general == "tshuss__xuanwu" then
        table.removeOne(ss,"tshu_north")
      end
      room:notifySkillInvoked(target,self.name,"big")
      room:broadcastPlaySound("./audio/system/losemaxhp")
      room:notifySkillInvoked(player,self.name,"drawcard")
      if #ss > 0 then
        room:setPlayerMark(player,"@tshu__4shen",ss)
      else
        room:setPlayerMark(player,"@tshu__4shen",0)
        player:gainAnExtraTurn(true)
      end
      room.logic:breakTurn()
    end
  end,
}
local gongzhu_prohibit = fk.CreateProhibitSkill{
  name = "#tshu__gongzhu_prohibit",
  prohibit_use = function(self, player, card)
      return player:hasSkill(self) and ((card.type == Card.TypeTrick and type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_east")) or (card.type == Card.TypeBasic and type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_north")))
  end,
  prohibit_response = function(self, player, card)
      return player:hasSkill(self) and (card.type == Card.TypeBasic and type(player:getMark("@tshu__4shen")) == "table" and table.contains(player:getMark("@tshu__4shen"),"tshu_north"))
  end,
}
gongzhu:addRelatedSkill(gongzhu_prohibit)
Fk:addSkill(gongzhu)
Fk:loadTranslationTable{
  ["tshu__gongzhu"] = "宫主",
  ["#tshu__gongzhu_prohibit"] = "宫主",
  [":tshu__gongzhu"] = "锁定技，<br>当你持有“四象”标记时，防止你受到的所有伤害和体力流失；"..
  "<br>若你持有<font color='green'>“东宫”</font>，你无法使用锦囊牌，否则你使用普通锦囊牌时指定全场敌方角色为目标；"..
  "<br>若你持有<font color='red'>“南宫”</font>，你无法使用或打出基本牌，否则你使用基本牌无法被响应；"..
  "<br>若你持有<font color='yellow'>“西宫”</font>，你跳过摸牌阶段，否则你的摸牌阶段开始时随机获得全场所有敌方角色两张牌；"..
  "<br>若你持有<font color='blue'>“北宫”</font>，你无法造成伤害，否则你每次造成伤害后回复一点体力；"..
  "<br>当场上四大神兽死亡时，你移除对应“四象”标记并结束当前回合；若你因此失去了全部“四象”，你立即获得一个额外的回合。",

}

--星象技

local east = fk.CreateTriggerSkill{
  name = "tshu__east",
  anim_type = "offensive",
  --mute = true,
  global = true,
  priority = 5,
  frequency = Skill.Compulsory,
  events = {fk.CardUsing},
  can_trigger = function(self, event, target, player, data)
    return target == player and (player.room:getBanner("@[:]tshu__xingxiang") or 0) == self.name and player.phase == Player.Play and data.card and data.card:isCommonTrick()  and
    not table.contains(data.card.skillNames, self.name) and player:usedSkillTimes(self.name, Player.HistoryTurn) < 3
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local name = Fk:cloneCard(data.card.name)
    name.skillName = "tshu__east"
    local use ={
        from = player.id,
        tos = data.tos,
        card = name,
        extraUse = true
      }
    room:useCard(use)
  end,
}
Fk:addSkill(east)
Fk:loadTranslationTable{
  ["tshu__east"] = "<font color='green'>东宫</font>",
  [":tshu__east"] = "锁定技，每名角色每回合限三次，出牌阶段使用的锦囊牌额外结算一次。",

}

local south = fk.CreateTriggerSkill{
  name = "tshu__south",
  anim_type = "offensive",
  --mute = true,
  global = true,
  priority = 5,
  frequency = Skill.Compulsory,
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    return target == player and (player.room:getBanner("@[:]tshu__xingxiang") or 0) == self.name and player.phase == Player.Play and data.damageType ~= fk.NormalDamage and player:usedSkillTimes(self.name, Player.HistoryTurn) < 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.damage = data.damage + 2
  end,
}
Fk:addSkill(south)
Fk:loadTranslationTable{
  ["tshu__south"] = "<font color='red'>南宫</font>",
  [":tshu__south"] = "锁定技，每名角色每回合限一次，出牌阶段造成的属性伤害+2。",

}

local west = fk.CreateTriggerSkill{
  name = "tshu__west",
  anim_type = "offensive",
  --mute = true,
  global = true,
  priority = 5,
  frequency = Skill.Compulsory,
  events = {fk.CardUsing},
  can_trigger = function(self, event, target, player, data)
    return target == player and (player.room:getBanner("@[:]tshu__xingxiang") or 0) == self.name and player.phase == Player.Play and data.card and data.card.trueName == "slash" and player:usedSkillTimes(self.name, Player.HistoryTurn) < 2
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.disresponsiveList = data.disresponsiveList or {}
    for _, p in ipairs(room.alive_players) do
      table.insertIfNeed(data.disresponsiveList, p.id)
    end
  end,
}
Fk:addSkill(west)
Fk:loadTranslationTable{
  ["tshu__west"] = "<font color='yellow'>西宫</font>",
  [":tshu__west"] = "锁定技，每名角色每回合限两次，出牌阶段使用的【杀】无法被响应。",

}

local north = fk.CreateTriggerSkill{
  name = "tshu__north",
  anim_type = "support",
  --mute = true,
  global = true,
  priority = 5,
  frequency = Skill.Compulsory,
  events = {fk.Damaged},
  can_trigger = function(self, event, target, player, data)
    return target == player and (player.room:getBanner("@[:]tshu__xingxiang") or 0) == self.name and player.phase == Player.NotActive  and player:isWounded() and player:usedSkillTimes(self.name, Player.HistoryTurn) < 2
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if not player.dead then
      room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = self.name
        })
    end
  end,
}
Fk:addSkill(north)
Fk:loadTranslationTable{
  ["tshu__north"] = "<font color='blue'>北宫</font>",
  [":tshu__north"] = "锁定技，每名角色每回合限两次，受到伤害后回复一点体力。",

}
return extension